package com.Tadama.Forms;

import com.Tadama.MIDlet.TadamaMIDlet;
import com.Tadama.Utility.CommandBuilder;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

public class lstProductos extends List implements CommandListener{
    private TadamaMIDlet mainMidlet;
    private Displayable previousDisplay;
    private Command cmAtras = CommandBuilder.getback();
    private Command cmSiguiente = CommandBuilder.getSiguiente();
 
    public lstProductos(TadamaMIDlet mainMidlet, String title, int listType,Displayable previousDisplay) {
        super(title, listType);
        this.mainMidlet = mainMidlet;
        this.previousDisplay = previousDisplay;
        this.append("Producto 01", null);
        this.append("producto 03", null);
        this.append("Producto 04", null);
        this.append("producto 10", null);
        this.append("Producto 08", null);
        this.addCommand(cmAtras);
        this.addCommand(cmSiguiente);
        this.setCommandListener(this);
    }

    public void commandAction(Command c, Displayable d) {
        if(c==cmSiguiente){
            Display.getDisplay(mainMidlet).setCurrent(new frmPedido(mainMidlet, previousDisplay));
        }
        if(c==cmAtras){
            Display.getDisplay(mainMidlet).setCurrent(new frmBuscarClientes("Buscar Clientes", mainMidlet, previousDisplay));
        }
    }
}